<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//判断数据是否提交
require ("../db_conn.php");
if(isset($_POST))
{
    $yhm=trin($_POST['yhm']);//trinf去掉空格
    $mm=trin($_POST['mm']);
    
    //
    $sql="select * from users where username='$yhm'";
    $rs=$db->query($sql);
    $row=$rs->fetch_array();
    if ($row)
    {
        //有这个用户，验证密码，密码正确跳转到后台页，密码不正确跳转logi.php
        if($row['dlmm']==md5($mm))
        {
        header("Location:user.php");
        }        
     else 
     {
        echo "<script>alert('密码错误！');window.location.href='login.php'</script>";
     }
}
 else 
     {
     echo "<script>alert('用户名错误！');window.location.href='login.php'</script>";
     
    }
}
